Skip to content

fix: address code review findings#21

Merged
peter-svensson merged 2 commits intomainfrom
fix/code-review-findings
Apr 1, 2026
Merged

fix: address code review findings#21
peter-svensson merged 2 commits intomainfrom
fix/code-review-findings

Conversation

@peter-svensson
Copy link
Copy Markdown
Member

Summary

  • H1: Add double-start guard in Connection.start() to throw if already connected
  • H2: Make applyDeadLetterOptions pure by spreading input into new object
  • H3: Change QueueConsumer.handlers from readonly to private with getHandlers() accessor
  • H4: Add outer .catch on the handler promise chain in handleMessage to catch ack/nack failures
  • M1: Replace Math.random() with crypto.randomUUID() in randomSuffix()
  • M3: Use URL class for parsing in appendHeartbeat() with fallback for non-standard AMQP URLs
  • L1: Redact credentials from URL before logging in start()
  • Refactors QueueConsumer constructor to use options object (reduces positional params)
  • Extracts setupPublisher, setupConsumer, setupRequestConsumer private methods
  • Updates tests to match new signatures

Test plan

  • TypeScript build passes (bun run build)
  • All 77 tests pass, 0 failures (bun test)
  • Pre-commit hooks pass

H1: Double-start guard in Connection.start()
H2: applyDeadLetterOptions returns new object instead of mutating input
H3: QueueConsumer.handlers changed from readonly to private
H4: handleMessage adds outer .catch for ack/nack failures
M1: randomSuffix uses crypto.randomUUID() instead of Math.random()
M3: appendHeartbeat uses URL class for parsing
L1: Redact credentials from URL before logging

Also refactors QueueConsumer constructor to use options object,
extracts setupPublisher/setupConsumer/setupRequestConsumer methods,
and updates tests to match new signatures.
@peter-svensson peter-svensson force-pushed the fix/code-review-findings branch from fc894fb to 995c1ae Compare April 1, 2026 19:30
@peter-svensson peter-svensson enabled auto-merge (squash) April 1, 2026 19:30
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 75.15528% with 40 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/connection.ts 74.32% 38 Missing ⚠️
src/consumer.ts 84.61% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@peter-svensson peter-svensson disabled auto-merge April 1, 2026 21:09
@peter-svensson peter-svensson merged commit 34d7ccf into main Apr 1, 2026
3 of 4 checks passed
@peter-svensson peter-svensson deleted the fix/code-review-findings branch April 1, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant